<template>
  <div class="card-component grid grid-cols-3 gap-5">
    <el-card v-for="item in cardList" :body-style="{ padding: '0px' }">
        <img :src="item.imgSrc" class="image" />
        <div style="padding: 14px">
          <span>{{ item.title }}</span>
          <div class="bottom">
            <time class="description">{{ item.description }}</time>
            <el-button text @click="router.go(item.skipUrl)">{{item.actionLabel || '跳转' }}</el-button>
          </div>
        </div>
      </el-card>
  </div>
  
</template>

<script lang="ts" setup>
import { useRouter } from 'vitepress'
const props = defineProps<{
  cardList: Array<{
    imgSrc?: string,
    title: string,
    description?: string
    actionLabel?: string
    skipUrl: string
  }>

}>()

const router = useRouter()

</script>

<style lang="scss" scoped>
.card-component { 
  // display: flex;
  // flex-wrap: wrap;
  // justify-content: space-between;
  .image {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
  }
  .bottom {
    margin-top: 13px;
    line-height: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .description {
      font-size: 12px;
      color: #999;
    }
  }


}


</style>